package day4;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ListTest {
    public static void main(String[] args) {
        List list=new ArrayList();//用数组
        list.add("aaa");
        list.add("bb");
        list.add("dog");
        list.add(Math.PI);
        list.add("cat");
        list.add("dog");
        System.out.println(list.size());
        Object o=list.get(2);
        System.out.println("第三个是"+o);
        System.out.println(">>>>>>>>>>>>>");
        for (int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }
        System.out.println("增强for:");
        for(Object oo:list)
            System.out.println(oo);

        System.out.println(">>>>>>>>>是否包含:");
        Scanner in=new Scanner(System.in);
        System.out.println("是否包含：");
        String str=in.next();
        //indexOf:找位置  -1
        System.out.println(list.contains(str));
        System.out.println("请输入删除的位置：");
        Object remove = list.remove(in.nextInt());
        System.out.println("删除后："+list);
    }
}
